package org.monkey.example.order.entity.dto;

import java.math.BigDecimal;
import lombok.Data;
import org.monkey.example.order.entity.form.OrderForm;
import org.monkey.example.order.entity.po.OrderPo;


@Data
public class OrderDto {

  private Long id;

  private String orderNumber;

  private Long accountId;

  private BigDecimal amount;

  public OrderDto(OrderPo orderPo) {
    this.id = orderPo.getId();
    this.orderNumber = orderPo.getOrderNumber();
    this.accountId = orderPo.getAccountId();
    this.amount = orderPo.getAmount();
  }

  public OrderDto(OrderForm orderForm) {
    this.id = orderForm.getId();
    this.accountId = orderForm.getAccountId();
    this.amount = BigDecimal.valueOf(orderForm.getAmount());
  }
}
